home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / internal / m68k / m68k-native / forbid.s < prev    next >
Encoding:
Text File  |  1996-07-16  |  1.3 KB  |  59 lines

  1. |*****************************************************************************
  2. |
  3. |   NAME */
  4. |
  5. |    __AROS_LH0(void, Forbid,
  6. |
  7. |   LOCATION
  8. |    struct ExecBase *, SysBase, 22, Exec)
  9. |
  10. |   FUNCTION
  11. |    Forbid any further taskswitches until a matching call to Permit().
  12. |    Naturally disbaling taskswitches means:
  13. |
  14. |    THIS CALL IS DANGEROUS
  15. |
  16. |    Do not use it without thinking very well about it or better don't use
  17. |    it at all. Most of the time you can live without it by using semaphores
  18. |    or similar.
  19. |
  20. |    Calls to Forbid() nest, i.e. for each call to Dorbid() you need one
  21. |    call to Enable().
  22. |
  23. |   INPUTS
  24. |
  25. |   RESULT
  26. |
  27. |   NOTES
  28. |    This function preserves all registers.
  29. |
  30. |    To prevent deadlocks calling Wait() in forbidden state breaks the
  31. |    firbid - thus taskswitches may happen again.
  32. |
  33. |   EXAMPLE
  34. |
  35. |   BUGS
  36. |
  37. |   SEE ALSO
  38. |    Permit(), Disable(), Enable(), Wait()
  39. |
  40. |   INTERNALS
  41. |
  42. |   HISTORY
  43. |
  44. |******************************************************************************
  45.  
  46.     TDNestCnt   =    0x127
  47.  
  48.     .globl    _Exec_Forbid
  49. _Exec_Forbid:
  50.     | increment nesting count and return
  51.     | this seems to be a very unspectacular call and a good job for a C
  52.     | routine - but nothing in C can guarantee to preserve all registers
  53.     | and to increment atomically - so better use this simple assembly
  54.     | routine
  55.     addqb    #1,a6@(TDNestCnt)
  56.     rts
  57.  
  58.  
  59.